package com.iflysse.common;

/**
 * TODO
 *
 * @author My
 * @date 2021/10/19 14:21
 */
public enum ResultEnum {
    //
    SUCCESS(1000,"操作成功"),
    NOPARAMETER(1001,"参数错误"),
    ERROR(1002,"服务器异常，请稍后再试"),
    CODEERROR(1003,"验证码错误"),
    UNDEFINE(-1,"未定义异常");

    private int code;
    private String msg;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    ResultEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static String msg(int code){
        for(ResultEnum m : ResultEnum.values()){
            if(m.getCode() == code){
                return m.getMsg();
            }
        }
        return UNDEFINE.getMsg();
    }
}
